CREATE DATABASE  IF NOT EXISTS `lapidb` /*!40100 DEFAULT CHARACTER SET latin1 */;
USE `lapidb`;
-- MySQL dump 10.13  Distrib 5.5.16, for Win32 (x86)
--
-- Host: localhost    Database: lapidb
-- ------------------------------------------------------
-- Server version	5.5.23

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `centrodeportivo`
--

DROP TABLE IF EXISTS `centrodeportivo`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `centrodeportivo` (
  `ID_CentroDeportivo` int(11) NOT NULL AUTO_INCREMENT,
  `Descripcion` text,
  `Activo` tinyint(1) DEFAULT NULL,
  `Direccion` varchar(90) DEFAULT NULL,
  `Telefono` varchar(10) DEFAULT NULL,
  PRIMARY KEY (`ID_CentroDeportivo`)
) ENGINE=InnoDB AUTO_INCREMENT=26 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `usuario`
--

DROP TABLE IF EXISTS `usuario`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `usuario` (
  `ID_Usuario` int(11) NOT NULL AUTO_INCREMENT,
  `Nombre` text,
  `Apellido` text,
  `Apellido2` text,
  `DNI` varchar(10) DEFAULT NULL,
  `Usuario` varchar(45) DEFAULT NULL,
  `Password` varchar(45) DEFAULT NULL,
  `Fx_registro` datetime DEFAULT NULL,
  `ID_Permisos` int(11) DEFAULT NULL,
  `Activo` tinyint(1) DEFAULT NULL,
  `Email` varchar(45) DEFAULT NULL,
  PRIMARY KEY (`ID_Usuario`)
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `deportes`
--

DROP TABLE IF EXISTS `deportes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `deportes` (
  `ID_Deportes` int(11) NOT NULL AUTO_INCREMENT,
  `Descripcion` text,
  `Activo` tinyint(1) DEFAULT NULL,
  `Color` varchar(7) DEFAULT NULL,
  PRIMARY KEY (`ID_Deportes`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `reservas`
--

DROP TABLE IF EXISTS `reservas`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `reservas` (
  `ID_Reservas` int(11) NOT NULL AUTO_INCREMENT,
  `ID_Usuario` int(11) DEFAULT NULL,
  `ID_DeportesPista` int(11) DEFAULT NULL,
  `Hora_Ini` datetime DEFAULT NULL,
  `Hora_Fin` datetime DEFAULT NULL,
  `Activo` tinyint(1) DEFAULT NULL,
  `Luz` tinyint(1) DEFAULT NULL,
  `Importe` double DEFAULT NULL,
  PRIMARY KEY (`ID_Reservas`),
  KEY `FK_Usuario` (`ID_Usuario`),
  KEY `FK_DeportesPista` (`ID_DeportesPista`),
  CONSTRAINT `FK_DeportesPista` FOREIGN KEY (`ID_DeportesPista`) REFERENCES `deportespista` (`ID_DeportesPista`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Usuario` FOREIGN KEY (`ID_Usuario`) REFERENCES `usuario` (`ID_Usuario`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=20 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `pista`
--

DROP TABLE IF EXISTS `pista`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `pista` (
  `ID_Pista` int(11) NOT NULL AUTO_INCREMENT,
  `ID_CentroDeportivo` int(11) NOT NULL,
  `Descripcion` text,
  `Hora_Ini` datetime DEFAULT NULL,
  `Hora_Fin` datetime DEFAULT NULL,
  `Luz` tinyint(1) DEFAULT NULL,
  `Activo` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`ID_Pista`),
  KEY `FK_CentroDeportivo` (`ID_CentroDeportivo`),
  CONSTRAINT `FK_CentroDeportivo` FOREIGN KEY (`ID_CentroDeportivo`) REFERENCES `centrodeportivo` (`ID_CentroDeportivo`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `deportespista`
--

DROP TABLE IF EXISTS `deportespista`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `deportespista` (
  `ID_DeportesPista` int(11) NOT NULL AUTO_INCREMENT,
  `ID_Pista` int(11) NOT NULL,
  `ID_Deportes` int(11) NOT NULL,
  `Precio` double DEFAULT NULL,
  `SuplementoLuz` double DEFAULT NULL,
  `Activo` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`ID_DeportesPista`),
  KEY `FK_Deportes` (`ID_Deportes`),
  KEY `FK_Pista` (`ID_Pista`),
  CONSTRAINT `FK_Deportes` FOREIGN KEY (`ID_Deportes`) REFERENCES `deportes` (`ID_Deportes`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `FK_Pista` FOREIGN KEY (`ID_Pista`) REFERENCES `pista` (`ID_Pista`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `permisos`
--

DROP TABLE IF EXISTS `permisos`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `permisos` (
  `ID_Permisos` int(11) NOT NULL AUTO_INCREMENT,
  `Descripcion` text,
  `Activo` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`ID_Permisos`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Table structure for table `admincentro`
--

DROP TABLE IF EXISTS `admincentro`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `admincentro` (
  `idAdminCentro` int(11) NOT NULL AUTO_INCREMENT,
  `id_usuario` int(11) NOT NULL,
  `id_centrodeportivo` int(11) NOT NULL,
  PRIMARY KEY (`idAdminCentro`),
  KEY `fk_admincentro_centrodeportivo` (`id_centrodeportivo`),
  KEY `fk_admincentro_usuario` (`id_usuario`),
  CONSTRAINT `fk_admincentro_centrodeportivo` FOREIGN KEY (`id_centrodeportivo`) REFERENCES `centrodeportivo` (`ID_CentroDeportivo`) ON DELETE NO ACTION ON UPDATE NO ACTION,
  CONSTRAINT `fk_admincentro_usuario` FOREIGN KEY (`id_usuario`) REFERENCES `usuario` (`ID_Usuario`) ON DELETE NO ACTION ON UPDATE NO ACTION
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=latin1;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2012-05-27 18:43:38
